package com.canbot.u05.view;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.canbot.u05.R;

/**
 * 商品语音设置
 */

public class MerchandiseWelcomeDialog extends Dialog {

        private Context context;

        private Button leftButton, rightButton;

        private String leftText, rightText;

        public MerchandiseWelcomeDialog(Context context, String leftText, String rightText) {
                super(context, R.style.MyDialogStyle);
                this.context = context;
                this.leftText = leftText;
                this.rightText = rightText;
                setCustomDialog();
        }

        private void setCustomDialog() {
                View mView = LayoutInflater.from(context).inflate(R.layout.layout_merchandise_welcome, null);
                leftButton = (Button) mView.findViewById(R.id.welcome_text);
                rightButton = (Button) mView.findViewById(R.id.welcome_audio);
                leftButton.setText(leftText);
                rightButton.setText(rightText);
                super.setContentView(mView);


        }

        //    public void setTitle(String text){
//        title.setText(text);
//    }
//    public EditText getEditText(){
//        return editText;
//    }
        @Override
        public void setContentView(int layoutResID) {
        }

        @Override
        public void setContentView(View view, ViewGroup.LayoutParams params) {
        }

        @Override
        public void setContentView(View view) {
        }


        /**
         * 确定键监听器
         *
         * @param listener
         */
        public void setOnRightListener(View.OnClickListener listener) {
                rightButton.setBackgroundResource(R.drawable.welcome_audio);
                rightButton.setOnClickListener(listener);
        }

        /**
         * 取消键监听器
         *
         * @param listener
         */
        public void setOnLeftListener(View.OnClickListener listener) {
                rightButton.setBackgroundResource(R.drawable.welcome_text);
                leftButton.setOnClickListener(listener);
        }

}
